/*! 
 * WeX5 v3 (http://www.justep.com) 
 * Copyright 2015 Justep, Inc.
 * Licensed under Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) 
 */
define(function(require) {
    var $ = require("jquery");
    var justep = require("$UI/system/lib/justep");
    var BizDesignComp = require("$UI/system/components/designerCommon/comp/bizDesignComp");
    require('css!./css/wxPay').load();


    function create(comp, clz) {
        var $domNode = $(comp.domNode);
        comp.domNode.style.position = "absolute";
        if (!comp.domNode.style.top) {
            comp.domNode.style.top = "10px";
            comp.domNode.style.left = "10px";
        }
        $domNode.addClass(clz).html('');
    }
    var wxPay = BizDesignComp.extend({

        // 初始化
        init: function(value, bindingContext) {
            create(this, 'x-wxPay');
            this.callParent(value, bindingContext);

        },
        // 构造函数
        constructor: function(options) {
            this.callParent(options);
        },

    });
    justep.Component.addOperations(wxPay, {
        'sendPay': {
            label: '确认订单',
            argsDef: [],
            method: function(args) {}
        }
    });

    var quickIdeEx = {
        "wxPayComp:wxPay": {
            properties: [{
                name: "label",
                text: "显示名称"
            },"outTradeno","totalFee","shopName","productName","productId","limitPay"],
            events: [{
                name: "on:payBefore",
                text: "支付前"
            }, {
                name: "on:paySuccess",
                text: "支付成功"
            }, {
                name: "on:payFail",
                text: "支付失败"
            }],
            operations: function() {
                return [{
                    groupName: "微信支付",
                    items: [{
                        name: 'sendPay',
                        label: "发起支付",
                        argExtends: {

                        }
                    }]
                }];
            },
            displayName: function(config) {
                return "微信支付";
            }
        }
    };

    return {
        'wxPayComp:wxPay': wxPay,
        quickIdeEx: quickIdeEx,
    };
});